home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / grafik / raytracing / rayshade-4.0.6.3 / libray / libobj / triangle.h < prev   
Encoding:
C/C++ Source or Header  |  1994-08-09  |  1.7 KB  |  61 lines

  1. /*
  2.  * triangle.h
  3.  *
  4.  * Copyright (C) 1989, 1991, Craig E. Kolb
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  *
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  * triangle.h,v 4.1 1994/08/09 08:00:23 explorer Exp
  17.  *
  18.  * triangle.h,v
  19.  * Revision 4.1  1994/08/09  08:00:23  explorer
  20.  * Bump version to 4.1
  21.  *
  22.  * Revision 1.1.1.1  1994/08/08  04:52:11  explorer
  23.  * Initial import.  This is a prerelease of 4.0.6enh3, or 4.1 possibly.
  24.  *
  25.  * Revision 4.0  91/07/17  14:39:43  kolb
  26.  * Initial version.
  27.  * 
  28.  */
  29. #ifndef TRIANGLE_H
  30. #define TRIANGLE_H
  31.  
  32. #define FLATTRI        0
  33. #define PHONGTRI    1
  34.  
  35. #define GeomTriangleCreate(t,a,b,c,d,e,f,g,h,i,s)  GeomCreate( \
  36.         (GeomRef)TriangleCreate(t,a,b,c,d,e,f,g,h,i,s), TriangleMethods())
  37.  
  38. /*
  39.  * Triangle
  40.  */
  41. typedef struct {
  42.     Vector    nrm,        /* triangle normal */
  43.         p[3],        /* vertices */
  44.         e[3],        /* "edge" vectors (scaled) */
  45.         *vnorm,        /* Array of vertex normals */
  46.         *dpdu, *dpdv;    /* U and V direction vectors */
  47.     Float    d,        /* plane constant  */
  48.         b[3];        /* Array of barycentric coordinates */
  49.     Vec2d    *uv;        /* Array of UV coordinates of vertices */
  50.     char    index,        /* Flag used for shading/intersection test. */
  51.         type;        /* type (to detect if phong or flat) */
  52. } Triangle;
  53.  
  54. extern Triangle    *TriangleCreate();
  55. extern int    TriangleIntersect(), TriangleNormal();
  56. extern void    TriangleBounds(), TriangleUV(),
  57.         TriangleStats();
  58. extern Methods    *TriangleMethods();
  59. char        *TriangleName();
  60. #endif /* TRIANGLE_H */
  61.